package com.ai.model.page;

import cn.hutool.core.util.StrUtil;
import com.ai.entity.BasePage;
import com.ai.entity.made.CoalMaintenanceAlarmRecord;
import com.ai.entity.made.CoalRoutingInspectionAlarmRecord;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @Author jiaok
 * @Date 2024-10-30 16:53
 */
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CoalMaintenancePage extends BasePage<CoalMaintenanceAlarmRecord> {

    @ApiModelProperty(value = "检修状态(1检修中，2检修正常,3检修时长不足)")
    private String maintenanceState;


    /**
     * 当前用户管理的区域信息
     */
    private List<String> cameraCodes;

    /**
     * 区域id
     */
    private String regionBaseId;

    /**
     * 拥有的摄像头列表
     */
    private List<String> cameraIdList;
    @Override
    public QueryWrapper<CoalMaintenanceAlarmRecord> getQuery(QueryWrapper<CoalMaintenanceAlarmRecord> queryWrapper) {
        return super.getQuery(queryWrapper)
                .eq(!StrUtil.isEmpty(maintenanceState),"maintenance_state",maintenanceState)
//                .in((!CollectionUtils.isEmpty(cameraCodes) && cameraCodes.size() > 0), "camera_code", cameraCodes)
                .in((!CollectionUtils.isEmpty(cameraIdList) && cameraIdList.size() > 0), "camera_id", cameraIdList)
                .orderByDesc("create_time");
    }
}
